// components/class-son-rili/rili.js
Component({

  properties: {
    index: {
      type: String,
      // value:'100',
      observer: function(newVal, oldVal, changePath) {
        // console.log(newVal, oldVal, changePath)
        // let val = newVal < 10 ? '0' + newVal.toString() : newVal.toString()  //会引起无限递归
        let val = newVal.toString().padStart('2', 0)
        this.setData({
          index: val
        })
      }
    }
  },


  data: {
    year: 0,
    month: '',
    months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
  },

  // 生命周期函数
  attached() {
    // console.log(this.data)
    // console.log(this.properties)
    let date = new Date()
    let y = date.getFullYear()
    let m = date.getMonth()+1
    this.setData({
      year: y,
      month: this.data.months[m-1]
    })

  },


  methods: {

  }
})